[HVM] Move IOAPIC ID back to 0x00. Shift LAPIC IDs to 0x01 upwards.
authorkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 27 Nov 2006 12:00:01 +0000 (12:00 +0000)
committerkfraser@localhost.localdomain <kfraser@localhost.localdomain>
Mon, 27 Nov 2006 12:00:01 +0000 (12:00 +0000)
Actually the conflict between LAPIC ID 0x00 and IOAPIC ID 0x00
really doesn't matter even in a native system but we can avoid
any risk of a warning by shifting the LAPIC ID space by one.

Also the changeset fixes construction of the MADT (LAPIC info
was overwriting the IOAPIC info) so we can now boot with ACPI
MADT again.

Signed-off-by: Keir Fraser <keir@xensource.com>
tools/firmware/hvmloader/acpi/build.c
tools/firmware/hvmloader/config.h
tools/firmware/hvmloader/mp_tables.c
xen/arch/x86/hvm/vlapic.c

index 84ae2c96e0a1bf2aae30d66a127e39046933cf6d..8d067fdaedf5c26ba3aa7450eb742ffb4f980bae 100644 (file)
@@ -88,14 +88,13 @@ int construct_madt(struct acpi_20_madt *madt)
     io_apic->ioapic_addr = IOAPIC_BASE_ADDRESS;
     offset += sizeof(*io_apic);
 
-    lapic = (struct acpi_20_madt_lapic *)io_apic;
+    lapic = (struct acpi_20_madt_lapic *)(io_apic + 1);
     for ( i = 0; i < get_vcpu_nr(); i++ )
     {
         memset(lapic, 0, sizeof(*lapic));
         lapic->type    = ACPI_PROCESSOR_LOCAL_APIC;
         lapic->length  = sizeof(*lapic);
-        lapic->acpi_processor_id = i;
-        lapic->apic_id = i;
+        lapic->acpi_processor_id = lapic->apic_id = i + 1;
         lapic->flags   = ACPI_LOCAL_APIC_ENABLED;
         offset += sizeof(*lapic);
         lapic++;
index b25a97236d9bb6046dce33df59325e3305efa5d8..18d906c4eb7bb535a3740fb23cdddd4c59e358de 100644 (file)
@@ -2,7 +2,7 @@
 #define __HVMLOADER_CONFIG_H__
 
 #define IOAPIC_BASE_ADDRESS 0xfec00000
-#define IOAPIC_ID           0xfe
+#define IOAPIC_ID           0x00
 #define IOAPIC_VERSION      0x11
 
 #define LAPIC_BASE_ADDRESS  0xfee00000
index 2c0f7b52c24d97eab3c72af6d4cfdfd88d5cbeeb..9a1238e51a65377a405f56cc434baf5620255bc3 100644 (file)
@@ -223,7 +223,7 @@ void fill_mp_config_table(struct mp_config_table *mpct, int length)
 void fill_mp_proc_entry(struct mp_proc_entry *mppe, int vcpu_id)
 {
     mppe->type = ENTRY_TYPE_PROCESSOR;
-    mppe->lapic_id = vcpu_id;
+    mppe->lapic_id = vcpu_id + 1;
     mppe->lapic_version = 0x11;
     mppe->cpu_flags = CPU_FLAG_ENABLED;
     if ( vcpu_id == 0 )
index 00b87ade41f4eb65eac2400d135da6a4389648a3..1c6bef005ebd6ed01b9ac8a0dcac4790b77c6e21 100644 (file)
@@ -240,7 +240,7 @@ static int vlapic_match_dest(struct vcpu *v, struct vlapic *source,
         if ( dest_mode == 0 )
         {
             /* Physical mode. */
-            if ( (dest == 0xFF) || (dest == v->vcpu_id) )
+            if ( (dest == 0xFF) || (dest == VLAPIC_ID(target)) )
                 result = 1;
         }
         else
@@ -900,7 +900,7 @@ static int vlapic_reset(struct vlapic *vlapic)
     struct vcpu *v = vlapic_vcpu(vlapic);
     int i;
 
-    vlapic_set_reg(vlapic, APIC_ID,  v->vcpu_id << 24);
+    vlapic_set_reg(vlapic, APIC_ID,  (v->vcpu_id + 1) << 24);
     vlapic_set_reg(vlapic, APIC_LVR, VLAPIC_VERSION);
 
     for ( i = 0; i < 8; i++ )